<?php
function member_list ($gametype)
{
    global $acl;
    global $user;
    global $curruser;
    global $conf;
    global $funlist;
    global $g_gametype_3d;
    global $g_init_mode_6h;
    global $g_init_mode_3d;
    $timeCheck = systime() - 2592000;
    $enabled = getvar("enabled");
    if ($enabled == "")
    {
        $enabled = 1;
    }
    $qctmp = "enabled>0";
    if ($enabled == 0)
    {
        $qctmp = "enabled=0";
    }
    $prev_id = isset($_GET['prev_id']) ? intval($_GET['prev_id']) : 0;
    $k_user = new k_users();
    echo $k_user->top_bar($gametype, "总代理商" . ( $enabled == 0 ? "停用" : "启用" ), $GLOBALS['funlist']);
    $page = getvar("page");
    if ($page == "")
    {
        $page = 1;
    }
    $reat0_open = $conf->get("reat0_open");
    $sql = "select * from k_user K where K.acl=" . $acl . " and K." . $qctmp;
    if ($curruser['acl'] < 255)
    {
        $users = GetUserList($curruser['id'], 3);
        if ($users == "")
        {
            $sql .= " and 1=0";
        }
        else
        {
            $sql .= " and id in (" . $users . ")";
        }
    }
    else if (0 < $prev_id)
    {
        $sql .= " and prev_id=" . $prev_id;
    }
    $sql .= " order by account";
    $rs = getdb($sql, $page);
    if ($rs->eof)
    {
        echo "<p><font color=red>" . L_NOGENAGENT . "</font></p>";
    }
    else
    {
        if (get_rate0_mode($rs->f['id']) == 0)
        {
            $reat0_open = 0;
        }
        echo "<table width=758 border=\"1\" cellspacing=\"1\" cellpadding=\"0\" class=\"mytable\">";
        echo "<tr class='td0 bgClc_{$gametype}' align=center>" . "<td nowrap>股东</td>" . "<td nowrap>总代理帐号</td>" . "<td nowrap>名称</td>";
		echo "<td nowrap>信用额度</td>";
		if ($reat0_open)
		{
			echo "<td nowrap>减倍</td>";
		}
		echo "<td nowrap>股东占成</td>";
        echo "<td nowrap>新增/更新</td>" . ( "<td nowrap>最後登入</td>" ) . "<td nowrap>下层</td>" . "<td nowrap>状况</td>" . "<td nowrap>功能设定</td>" . "</tr>";
        while (!$rs->eof)
        {
			$parent=getdb("select gametype,percent1 as mpercent from  k_user_percent where user_id = ".$rs->f['id']." and  gametype in (0,12) order by gametype");
			$mpercent6h=$mpercent3s3=0;
			while(!$parent->eof){
				if($parent->f['gametype']==0)
					$mpercent6h=$parent->f['mpercent'];
				else
					$mpercent3s3=$parent->f['mpercent'];
				$parent->next();
			}
			$parent->close();
            echo "<tr class=td2 onmouseover=msover() onmouseout=msout()>";
            $user1 = get_user($rs->f['prev_id']);
            echo "<td nowrap>" . $user1['account'];
            if ($timeCheck < $rs->f['createdt'])
            {
                $tempClass = " class=\"td4\" ";
            }
            else
            {
                $tempClass = "";
            }
            echo "<td nowrap {$tempClass}><a href='?op=genagent&fp=agent&gametype=" . $gametype . "&cmd=list&enabled=1&prev_id=" . $rs->f['id'] . "'>" . $rs->f['account'] . "</a>";
            echo "<td nowrap>" . $rs->f['name'];
            if (0 < $gametype)
            {
                switch ($gametype)
                {
                    case 1 :
                    case 2 :
                        $amounts = "amount_3d";
                        break;
                    default :
                        $amounts = "amount_3s1";
                        break;
                }
                echo "<td align=right nowrap>" . n_to_c($rs->f[$amounts]);
                echo "<td align=right nowrap>(6h){$mpercent6h}% / <font color=#0000ff>(快){$mpercent3s3}%</font>";
            }
            else
            {
                echo "<td align=right nowrap>" . n_to_c($rs->f['amount']);
                if ($reat0_open)
                {
                    echo "<td nowrap align=right>" . $rs->f['rate0'];
                }
                echo "<td align=right nowrap>(6h){$mpercent6h}% / <font color=#0000ff>(快){$mpercent3s3}%</font>";
            }
            echo "<td nowrap>" . ( $rs->f['updatedt'] == "" ? date("Y-m-d", $rs->f['createdt']) : date("Y-m-d", $rs->f['updatedt']) );
            echo "<td nowrap>" . ( $rs->f['lastlogdt'] == "" ? "" : date("Y-m-d", $rs->f['lastlogdt']) );
            $rs1 = getdb("select count(id) from k_user where enabled=1 and acl=2 and prev_id=" . $rs->f['id']);
            echo "<td nowrap align=right nowrap>" . $rs1->f[0];
            if ($rs->f['enabled'] == 1)
            {
                echo "<td nowrap align=center>" . L_ENABLE;
            }
            else if ($rs->f['enabled'] == 2)
            {
                echo "<td nowrap align=center bgcolor=red><font color=white>暂停</font>";
            }
            else
            {
                echo "<td nowrap align=center bgcolor=black><font color=white>" . L_DISABLE . "</font>";
            }
            echo "<td nowrap><a href='?op=shareowner&fp=genagent&gametype=" . $gametype . "&cmd=edit&id=" . $rs->f['id'] . "'>修改</a> ";
            echo ":: <a href='?op=agent&fp=amount_3d&gametype=" . $gametype . "&id=" . $rs->f['id'] . "'>限额</a> ";
            $rs->next();
        }
       echo "<tr class='td0 bgClc_{$gametype}'><td colspan=15>";
        if (1 < $page)
        {
            echo "<a class=td0 href='?op=shareowner&fp=genagent&gametype=" . $gametype . "&page=1&enabled=" . $enabled . "&prev_id=" . $prev_id . "'>" . L_FIRSTPAGE . "</a> &nbsp; ";
            echo "<a class=td0 href='?op=shareowner&fp=genagent&gametype=" . $gametype . "&page=" . ( $page - 1 ) . "&enabled=" . $enabled . "&prev_id=" . $prev_id . "'>" . L_PREVPAGE . "</a> &nbsp; ";
        }
        else
        {
            echo L_FIRSTPAGE . " &nbsp; " . L_PREVPAGE . " &nbsp; ";
        }
        if ($page < $rs->totalpages)
        {
            echo "<a class=td0 href='?op=shareowner&fp=genagent&gametype=" . $gametype . "&page=" . ( $page + 1 ) . "&enabled=" . $enabled . "&prev_id=" . $prev_id . "'>" . L_NEXTPAGE . "</a> &nbsp; ";
            echo "<a class=td0 href='?op=shareowner&fp=genagent&gametype=" . $gametype . "&page=" . $rs->totalpages . "&enabled=" . $enabled . "&prev_id=" . $prev_id . "'>" . L_LASTPAGE . "</a> &nbsp; ";
        }
        else
        {
            echo L_NEXTPAGE . " &nbsp; " . L_LASTPAGE . " &nbsp; ";
        }
        echo " &nbsp; &nbsp; " . L_PAGE . " <select onchange=\"location.href='op.php?op=" . $_GET['op'] . "&fp=" . $_GET['fp'] . "&gametype=" . $gametype . "&enabled=" . $enabled . "&prev_id=" . $prev_id . "&page=' + this.value\">";
        $i = 1;
        while ($i <= $rs->totalpages)
        {
            echo "<option value=" . $i;
            if ($page == $i)
            {
                echo " selected";
            }
            echo ">" . $i;
            ++$i;
        }
        echo "</select>";
        echo "，总共 " . $rs->totalpages . " 页，" . $rs->totalrecords . " " . L_RECORDERS;
        $rs->close();
        echo "</table>";
    }
}

function member_edit ($gametype)
{
    global $acl;
    global $user;
    global $curruser;
    global $funlist;
    global $conf;
    global $g_init_mode_6h;
    global $g_init_mode_3d;
    global $g_menu_enabled;
    global $aclname;
    global $g_gametype_3d;
    include_once( "class/class.disk.php" );
    $id = intval(getvar("id"));
    $stbl = new Show_genagent();
    $disk_chg = new disk();
    $editpercentwod = $conf->get("edit_percent_wod");
    $superadmin = $curruser['account'] == G_SUPERACCOUNT && $curruser['acl'] == 255 ? 1 : 0;
    echo $stbl->top_bar($gametype, "总代理商 " . ( 0 < $id ? "编辑" : "新增" ), $GLOBALS['funlist']);
    if ($id != "")
    {
        if ($curruser['acl'] < 4)
        {
            diemsg(L_NOACCESSEDIT);
        }
        if ($curruser['acl'] < 255)
        {
            $users = getuserlist($curruser['id'], 3);
            if ($users == "")
            {
                diemsg(L_NOTYOURAGENT);
            }
            if (strpos("," . $users . ",", "," . $id . ",") === false)
            {
                diemsg(L_NOTYOURGENAGENT);
            }
        }
    }
    if (isset($_GET['prev_id']))
    {
        $prev_id = intval($_GET['prev_id']);
    }
    else if (isset($_POST['prev_id']))
    {
        $prev_id = intval($_POST['prev_id']);
    }
    else
    {
        $prev_id = 0;
    }
    if ($prev_id == 0 && 0 < $id)
    {
        $user1 = user::getuser($id);
        $prev_id = $user1['prev_id'];
    }
    if ($prev_id == 0 && $curruser['acl'] == 4)
    {
        $prev_id = $curruser['id'];
    }
    else if (0 < $id)
    {
        $user1 = user::getuser($id);
        $prev_id = $user1['prev_id'];
    }
    $u_prev_user = user::getuser($prev_id);
    $modifyacc = $aclname[$curruser['acl']];
    if ($modifyacc == G_SUPERACCOUNT && $curruser['acl'] == 255)
    {
        $modifyacc = "Admin";
    }
	
    $tpl = new Template2();
    $tpl->load("main", "genagent.htm");
    $tpl->set("action", "?" . $_SERVER['QUERY_STRING']);
    $u_subsidary = get_user($u_prev_user['prev_id']);
    $reat0_open = $conf->get("reat0_open");
    $max_rate0 = floatval($conf->Get("max_rate0"));
    if ($u_subsidary['reat0_open'] == 0)
    {
        $reat0_open = 0;
    }
    $u_prev_percent_Arr = getUserPercents($prev_id);
    $maxamount_Arr = array();
    if (0 < $id)
    {
        $maxamount_Arr['6h'] = GetMyAmount($id);
        $maxamount_Arr['3d'] = GetMyAmount($id, "_3d");
        $maxamount_Arr['3s'] = GetMyAmount($id, "_3s1");
    }
    else if ($curruser['acl'] == $acl + 1)
    {
        $maxamount_Arr['6h'] = GetMyFreeAmount($curruser['id']);
        $maxamount_Arr['3d'] = GetMyFreeAmount($curruser['id'], "_3d");
        $maxamount_Arr['3s'] = GetMyFreeAmount($curruser['id'], "_3s1");
    }
    else if (0 < $prev_id)
    {
        $maxamount_Arr['6h'] = GetMyFreeAmount($prev_id);
        $maxamount_Arr['3d'] = GetMyFreeAmount($prev_id, "_3d");
        $maxamount_Arr['3s'] = GetMyFreeAmount($prev_id, "_3s1");
    }
    else
    {
        //exit();
    }
    if (ispost())
    {
        include_once( "genagent/k_user_post.php" );
    }
    $tmp = "<tr><td class=td1>股东<td class=td2 colspan=3>" . $u_prev_user['account'];
    $tmp .= "<input type=hidden name=prev_id value=" . $prev_id . "></td></tr>";
    $tpl->set("agentlist", $tmp);
    unset($tmp);
    $disk1_disab = "";
    $disk2_disab = "";
    $disk3_disab = "";
    $disk4_disab = "";
    $dk_check = $disk_chg->Browser($prev_id);
    if ($dk_check['disk1'] == 0)
    {
        $disk1_disab = "disabled";
    }
    if ($dk_check['disk2'] == 0)
    {
        $disk2_disab = "disabled";
    }
    if ($dk_check['disk3'] == 0)
    {
        $disk3_disab = "disabled";
    }
    if ($dk_check['disk4'] == 0)
    {
        $disk4_disab = "disabled";
    }
    $dk_browser = $disk_chg->Browser(0 < $id ? $id : $prev_id );
    $alldisk_3d = "";
    if ($dk_browser['disk1'] == 1)
    {
        $alldisk_3d .= "<input type=checkbox name=disk1mod checked> A 盘.&#12288;";
    }
    else
    {
        $alldisk_3d .= "<input type=checkbox name=disk1mod {$disk1_disab}> A 盘.&#12288;";
    }
    if ($dk_browser['disk2'] == 1)
    {
        $alldisk_3d .= "<input type=checkbox name=disk2mod checked> B 盘.&#12288;";
    }
    else
    {
        $alldisk_3d .= "<input type=checkbox name=disk2mod {$disk2_disab}> B 盘.&#12288;";
    }
    if ($dk_browser['disk3'] == 1)
    {
        $alldisk_3d .= "<input type=checkbox name=disk3mod checked> C 盘.&#12288;";
    }
    else
    {
        $alldisk_3d .= "<input type=checkbox name=disk3mod {$disk3_disab}> C 盘.&#12288;";
    }
    if ($dk_browser['disk4'] == 1)
    {
        $alldisk_3d .= "<input type=checkbox name=disk4mod checked> D 盘.&#12288;";
    }
    else
    {
        $alldisk_3d .= "<input type=checkbox name=disk4mod {$disk4_disab}> D 盘.&#12288;";
    }
    $tpl->set("alldisk_3d", $alldisk_3d);

	if (0 < $id)
    {
        $tpl->set("edit_disabled", "disabled");
        $rs = getdb("select * from k_user where acl=" . $acl . " and id=" . $id);
        if ($rs->eof)
        {
            diemsg("错误的总代里帐号！");
        }
        if (!( date("w") == $editpercentwod || $editpercentwod == 7 || $superadmin ))
        {
            $tpl->set("chk_percent_day", "yes");
        }
        if (date("w") == $editpercentwod || $editpercentwod == 7 || $superadmin || date("Ymd", $rs->f['createdt']) == date("Ymd", systime()))
        {
            $readmode = "";
        }
        else
        {
            $readmode = " readonly";
        }
        $account2 = $rs->f['account'];
        $tpl->set("passdesc", "<br><font color=#888888>有输入表示要更改使用者密码</font>");
        $tpl->set("noeditaccount", "disabled");
        $tpl->set("account", $rs->f['account']);
        $tpl->set("name", $rs->f['name']);
        $tpl->set("id", $id);
        $btnMymodifyStr = "<input type=button value=\"占成与信用额度异动记录\" onclick=\"javascript:showMymodifyPage({$gametype},'{$account2}');\">";
        $tpl->set("deletebutton", "<input type=button value=编辑限额 onclick=editamount(" . $id . "," . $gametype . ")>{$btnMymodifyStr}");
        foreach ($g_gametype_3d as $gameid => $val)
        {
            if ($g_init_mode_6h && $gameid == 0 || $g_init_mode_3d && $gameid && $g_menu_enabled[$gameid])
            {
                $percent_rs = getdb("!!select * from k_user_percent Where user_id = {$id} and gametype={$gameid}");
                if ($percent_rs->eof)
                {
                    CreatePercents($id, $gameid, $u_prev_percent_Arr);
                    $percent_rs = getdb("!!select * from k_user_percent Where user_id = {$id} and gametype={$gameid}");
                }
            }
            else
            {
                continue;
            }
			$data_6h = array("", $rs->f['amount'], $maxamount_Arr['6h']);
			$tpl->set("amount", $stbl->amount_6h($data_6h));
            switch ($gameid)
            {
                case 0 :
                    //if ($reat0_open)
                    //{
                    //    $tpl->set("reat0open", "<tr><td class=paper6h>六合彩特码减倍</tD><td class=td2><input name=rate0 value='" . $rs->f['rate0'] . "' size=4 maxlength=5></td></tr>");
                    //}
                    $disbmode = get_percentsw_mode3($prev_id, $gameid) == 1 ? " readonly" : "";
                    $percent_sw_mod = $percent_rs->f['percent_sw'] == 1 ? " checked" : "";
                    $data_6h = array("6h", "六合彩", $percent_rs->f['percent0'] . $readmode, $percent_rs->f['percent1'] . $readmode . $disbmode, $percent_rs->f['percent2'] . $readmode, $percent_rs->f['mpercent'] . $readmode, "&#12288;股东&#12288;", "总代理", $u_prev_percent_Arr[0]['mpercent'], "percent_sw" . $percent_sw_mod . $readmode);
                    $tpl->set("mpsen", $stbl->percent_6h($data_6h));
                    break;
                default :
                    /*if ($g_gametype_3d[$gameid]['type'] == 1)
                    {
                        $data_3d = array("3D彩共用", "3d", $rs->f['amount_3d'], $maxamount_Arr['3d']);
                        $tpl->set("amount_3d", $stbl->amount($data_3d));
                    }
                    else if (1 < $g_gametype_3d[$gameid]['type'])
                    {
                        $data_3s1 = array("时时彩共用", "3s1", $rs->f['amount_3s1'], $maxamount_Arr['3s']);
                        $tpl->set("amount_3s1", $stbl->amount($data_3s1));
                    }*/
                    break;
            }
            $disbmode = get_percentsw_mode3($prev_id, $gameid) == 1 ? " readonly" : "";
            $percent_sw_mod = intval($percent_rs->f['percent_sw']) ? " checked" : "";
			if($gameid==12){
            	$data = array($g_gametype_3d[$gameid]['en'], $g_gametype_3d[$gameid]['zc'], $percent_rs->f['percent0'] . $readmode, $percent_rs->f['percent1'] . $readmode . $disbmode, $percent_rs->f['percent2'] . $readmode, $percent_rs->f['mpercent'] . $readmode, "&#12288;股东&#12288;", "总代理", $u_prev_percent_Arr[$gameid]['mpercent'], "percent_sw_{$g_gametype_3d[$gameid]['en']}" . $percent_sw_mod . $readmode);
            	$tpl->set("mpsen_{$g_gametype_3d[$gameid]['en']}", $stbl->percent($data));
			}
        }
        $tpl->set("enabled0" . $rs->f['enabled'], "checked");
        $tpl->set("createdt", date("Y-m-d H:i:s", $rs->f['createdt']));
        if ($rs->f['updatedt'] != "")
        {
            $tpl->set("updatedt", date("Y-m-d H:i:s", $rs->f['updatedt']));
        }
        if ($rs->f['lastlogdt'] != "")
        {
            $tpl->set("lastlogdt", date("Y-m-d H:i:s", $rs->f['lastlogdt']));
            $tpl->set("lastlogip", $rs->f['lastlogip']);
        }
        $tpl->set("logcount", $rs->f['logcount']);
        if ($curruser['acl'] == "255")
        {
            $disabled = "";
            if ($rs->f['disabled'] == 1)
            {
                $disabled = "<input type='checkbox' name='mbr_disabled' CHECKED=checked> 全线禁止登入";
            }
            else
            {
                $disabled = "<input type='checkbox' name='mbr_disabled'> 全线禁止登入";
            }
            $tpl->set("mbr_disabled_chk", $disabled);
        }
    }
    else
    {
		$tpl->set("zctable","style='display:none'");
        $tmp = "<tr><td class=td1>股东<td class=td2 colspan=3>";
        if ($curruser['acl'] == 4)
        {
            $tmp .= $curruser['account'] . "<input type=hidden name=prev_id value=" . $curruser['id'] . ">";
        }
        else
        {
            if ($prev_id == 0)
            {
                $rs9 = false;
                echo "<p>请选择上层股东：</p><p><table border=0 cellpadding=2 cellspacing=1 class=table0>";
                echo "<tr class=td0><td nowrap>股东帐号<td nowrap>名称";
                if ($curruser['acl'] < 255)
                {
                    $users = getuserlist($curruser['id'], 4);
                    if ($users != "")
                    {
                        $rs9 = getdb("select id,account,name from k_user where id in (" . $users . ") and enabled=1 order by account");
                    }
                }
				else
					$rs9 = getdb("select id,account,name from k_user where acl=4 and enabled=1 order by account");
                if ($rs9)
                {
                    $prev_id_count = 0;
                    $first_prev_id = 0;
                    while (!$rs9->eof)
                    {
                        ++$prev_id_count;
                        if ($first_prev_id == 0)
                        {
                            $first_prev_id = $rs9->f['id'];
                        }
                        echo "<tr class=td2>";
                        echo "<td nowrap><a href=\"op.php?op=shareowner&fp=genagent&gametype=" . $gametype . "&cmd=add&prev_id=" . $rs9->f['id'] . "\">" . $rs9->f['account'] . "</a><td>" . $rs9->f['name'];
                        $rs9->movenext();
                    }
                    $rs9->close();
                    if ($prev_id_count == 1)
                    {
                        redirect("op.php?op=shareowner&fp=genagent&gametype=" . $gametype . "&cmd=add&prev_id=" . $first_prev_id);
                    }
                }
                else
                {
                    echo "<tr><td colspane=2>没有股东！";
                }
                echo "</table></p>";
            }
            else
            {
                $tmp .= $u_prev_user['account'];
            }
        }
        $tpl->set("agentlist", $tmp."</td></tr>");
        $tpl->set("enabled01", "checked");
        $prev_account = "b";
        if (G_ACCOUNT == 0)
        {
            $tpl->set("account", $prev_account);
            $tpl->set("account_msg", "帐号必须为 b 开头,长度4~16 码.");
        }
        else
        {
            $sql = "select distinct mid(account,3,1) as a from k_user where acl=" . $acl . " and account like '" . substr($u_prev_user['account'], 0, 2) . "%'";
            if ($curruser['acl'] != 255)
            {
                $users = getuserlist($curruser['id'], 3);
                $sql .= $users == "" ? " and 1=0" : " and id in (" . $users . ")";
            }
            $sql .= " order by a desc";
            $rs1 = getdb($sql);
            if ($rs1->f[0] != "")
            {
                $tmp1 = ord($rs1->f[0]);
                if (ord("a") <= $tmp1 && $tmp1 < ord("z"))
                {
                    $prev_account = chr(ord($rs1->f[0]) + 1);
                }
            }
            $tpl->set("account", $prev_account . substr($u_prev_user['account'], 0, 2));
            $tpl->set("account_msg", "帐号必须为6个以上的英文字母及数字混和组成, 长度勿超过16码.");
        }
    }
    $tpl->set("submit", 0 < $id ? "&#12288;确定&#12288;" : "&#12288;新增&#12288;" );
    $tpl->show("main");
}

if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
if ($curruser['acl'] == 255 && $curruser['prev_id'] != 0 && !SubAccountRight($curruser, 2))
{
    exit();
}
if (isset($_SESSION['subaccount']) && $curruser['acl'] < 255)
{
    exit();
}
if ($curruser['enabled'] == 2)
{
    exit();
}
$gametype = intval(getvar("gametype"));
$chkGametype = chkGametype($gametype);
if ($chkGametype)
{
    include_once( "class_3d/CheckMode_3d.php" );
    $chk = new CheckMode_3d($curruser['acl'], 1, $gametype);
    $chk->checkShow3dPage();
    unset($chk);
    $ui = new UI_3D(true, "报表管理");
    $jslink = "<script language=\"JScript.Encode\" src=\"site.js\"></script>" . ( "<script language=\"VBScript.Encode\" src=\"site.vbs\"></script>" );
    $ui->set("jslink", $jslink);
    $ui->header();
}
else
{
    $ui = new UI(true, "报表管理");
}
include_once( "class/class.acctMag.php" );
$conf = new Config();
$acl = 3;
$id = intval(getvar("id"));
$prev_id = intval(getvar("prev_id"));
$sql = "SELECT `prev_id` FROM `k_user` WHERE `id`={$id}";
$rs = getdb($sql);
switch (getvar("cmd"))
{
    case "add" :
        $funlist = "<a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=list&enabled=1&prev_id={$prev_id}\">" . L_ENABLEDLIST . "</a>" . " &nbsp; <a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=list&enabled=0&prev_id={$prev_id}\">" . L_DISABLEDLIST . "</a>";
        $funlist .= " &nbsp; <a href=\"javascript:history.back()\">回上一页</a>";
        member_edit($gametype);
        break;
    case "edit" :
        $funlist = "<a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=list&enabled=1&prev_id={$prev_id}\">" . L_ENABLEDLIST . "</a>" . " &nbsp; <a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=list&enabled=0&prev_id={$prev_id}\">" . L_DISABLEDLIST . "</a>" . " &nbsp; <a href=\"?op=genagent&fp=agent&gametype={$gametype}&cmd=add&prev_id={$id}\">新增下级</a>";
        $funlist .= " &nbsp; <a href=\"javascript:history.back()\">回上一页</a>";
        member_edit($gametype);
        break;
    case "list" :
    default :
        $funlist = "<a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=list&enabled=1&prev_id={$prev_id}\">" . L_ENABLEDLIST . "</a>" . " &nbsp; <a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=list&enabled=0&prev_id={$prev_id}\">" . L_DISABLEDLIST . "</a>" . " &nbsp; <a href=\"?op=shareowner&fp=genagent&gametype={$gametype}&cmd=add&prev_id={$prev_id}\">" . L_ADD . "</a>";
        member_list($gametype);
        break;
}
echo "</table>";
$ui->footer();
?>